﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="../css/uftestsuite.css" type="text/css" />
  <script type="text/javascript" src="phone-number.js"></script>
  <title>Microformats phone number formats</title>
  <script type="text/javascript">
  
  	function canonicalisePhoneNumber( id) {
  		elt = document.getElementById(id);
  		phoneNumber = new PhoneNumber( elt.value );
  		alert( phoneNumber.toString() );
  	}
  	
  	function compareNumbers( id1, id2 ) {
  		elt1 = document.getElementById(id1);
  		elt2 = document.getElementById(id2);
  		output = new PhoneNumber( elt1.value ).toString() + ' - ' + new PhoneNumber( elt2.value ).toString();
  		alert( 'Are equal: ' + ComparePhoneNumbers( elt1.value, elt2.value ) + '\n' + output );
  	}

  
  </script>
</head>
<body class="documentation">

    <p>
    <a href="http://www.ufxtract.com/testsuite/"><img border="0" id="testsuite-image" alt="Microformats testsuite" src="../images/testsuite.gif" /></a><br />
    </p>
    
    <h1>Microformats phone number formats</h1>
    
    <h2>Introduction</h2>
    <p>
    Although phone numbers are considered to be a string value in the
    Microformats specifications, some parsers do treat them as a data type and 
	perform different levels of validation. To allow the test-runner to test 
	parsers equally the following method canonicalise and compare phone numbers.   
    </p>
    
   
   
   <h2>Canonicalise phone number</h2>
   <p>This code takes a string phone number and provides a canonicalised version.</p>
	    
 
	<form>
		<input id="phoneNumber1" name="phoneNumber1" type="text" style="width: 256px" value="800-555-1212 " />
		<input name="normalise" type="button" value="canonicalise" onclick="canonicalisePhoneNumber('phoneNumber1')" />
	</form>
	
	
	<h2>Compare</h2>
   	<p>This code takes the two phone numbers and compares canonicalised version of them to see if they are equal.  </p>

	<form>
		<input id="phoneNumber2" name="phoneNumber2" type="text" style="width: 256px" value="+44 1273 715100" />
		<input id="phoneNumber3" name="phoneNumber3" type="text" style="width: 256px" value="+441273715100" />
		<input name="compare" type="button" value="compare" onclick="compareNumbers('phoneNumber2','phoneNumber3')" />
	</form>
	
	
	<h2>Examples of phone number canonicalisation</h2>

<pre>
01273 715100                  01273715100
+44 1273 715100               +441273715100
800-555-1212                  8005551212
800.555.1212                  8005551212
(800) 555-1212                8005551212
800-555-1212x1234             80055512121234
800-555-1212 ext. 1234        80055512121234 
work 1-(800) 555.1212 #1234   180055512121234 
</pre>

	
	<p>&nbsp;</p>

	<a rel="license" href="license.txt">Some rights reserved</a>
    
    
</body>
</html>
